home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 89 / 089.d81 / text to basic.s < prev    next >
Text File  |  2022-08-26  |  3KB  |  252 lines

  1. open =$ffc0
  2. readst =$ffb7
  3. stop =$ffe1
  4. setlfs =$ffba
  5. setnam =$ffbd
  6. load =$ffd5
  7. getin =$ffe4
  8. clrchn =$ffcc
  9. close =$ffc3   ;a
  10. chrin =$ffcf
  11. chkout =$ffc9  ;x
  12. chkin =$ffc6   ;x
  13. plot =$fff0
  14. chrout =$ffd2
  15. color'pointer =243
  16. screen'line'pointer =209
  17. print'number =$bdcd ;x,a
  18. clear'line =59903
  19. background =53281
  20. border =53280
  21. unlisten =$ffae
  22. clall =$ffe7
  23.  
  24. .org $c000
  25. .mem
  26.  
  27. ;sysaddr,source drive,dest drive,textfile,newfile,start line,inc
  28.  
  29. jmp start
  30. jmp instructions
  31.  
  32. start jsr get'number
  33. lda $14
  34. cmp #8
  35. bcs +
  36. lda #8
  37. + sta source
  38.  
  39. jsr get'number
  40. lda $14
  41. cmp #8
  42. bcs +
  43. lda #8
  44. + sta destination
  45.  
  46.  
  47. lda #0
  48. sta endflag
  49. jsr get'string
  50. jsr setnam
  51. lda #2
  52. ldx source
  53. ldy #8
  54. jsr setlfs
  55. jsr open
  56.  
  57. ldx #2
  58. jsr chkin
  59. jsr getin
  60. jsr getin
  61.  
  62. get'dest jsr get'string
  63. jsr setnam
  64. lda #3
  65. ldx destination
  66. ldy #1
  67. jsr setlfs
  68. jsr open
  69.  
  70. ldx #3
  71. jsr chkout
  72.  
  73. lda 43
  74. sta location
  75. jsr chrout
  76. lda 44
  77. sta location+1
  78. jsr chrout
  79.  
  80. get'starting jsr get'number
  81. lda $14
  82. sta starting'line
  83. lda $15
  84. sta starting'line+1
  85.  
  86. get'increment jsr get'number
  87. lda $14
  88. sta increment
  89. lda $15
  90. sta increment+1
  91.  
  92. here'we'go lda 197
  93. cmp #62
  94. bne +
  95. jmp end'of'file
  96.  
  97. + lda #6
  98. sta count
  99. lda location
  100. sta line
  101. lda location+1
  102. sta line+1
  103. lda starting'line
  104. sta line+2
  105. lda starting'line+1
  106. sta line+3
  107. lda #$83; token for DATA
  108. sta line+4
  109. lda #$22; quote
  110. sta line+5
  111.  
  112. lda #6
  113. clc
  114. adc location
  115. sta location
  116. bcc +
  117. inc location+1
  118.  
  119. + ldx #2
  120. jsr chkin
  121.  
  122. ldy #6
  123. - jsr getin
  124. beq end'of'line
  125. cmp #34
  126. bne +
  127. lda "'"
  128. + sta temp
  129.  
  130. jsr readst
  131. and #64
  132. beq +
  133.  
  134. dec endflag
  135. lda temp
  136. cmp #13
  137. beq eof'jump
  138. cmp #0
  139. beq eof'jump
  140. cmp #10
  141. beq eof'jump
  142. sta line,y
  143. iny
  144. eof'jump jmp end'of'line
  145.  
  146. + lda temp
  147. cmp #13
  148. beq end'of'line
  149.  
  150. cmp #10
  151. beq end'of'line
  152.  
  153. sta line,y
  154. inc location
  155. bne +
  156. inc location+1
  157. + iny
  158. cpy #254
  159. bcc -
  160.  
  161. end'of'line lda #$22
  162. sta line,y
  163. iny
  164. lda #0
  165. sta line,y
  166.  
  167. lda #2
  168. clc
  169. adc location
  170. sta location
  171. bcc +
  172. inc location+1
  173.  
  174. + iny
  175. sty count
  176.  
  177. lda location
  178. sta line
  179. lda location+1
  180. sta line+1
  181.  
  182. write ldx #3
  183. jsr chkout
  184.  
  185. ldy #0
  186. - lda line,y
  187. jsr chrout
  188. iny
  189. cpy count
  190. bne -
  191.  
  192. lda increment
  193. clc
  194. adc starting'line
  195. sta starting'line
  196. lda increment+1
  197. adc starting'line+1
  198. sta starting'line+1
  199.  
  200. bit endflag
  201. bvs end'of'file
  202.  
  203. jmp here'we'go
  204.  
  205. end'of'file lda #0
  206. jsr chrout
  207. jsr chrout
  208. jsr clrchn
  209. lda #3
  210. jsr close
  211. lda #2
  212. jmp close
  213.  
  214.  
  215.  
  216. ;***** get string from BASIC ****
  217.  
  218. get'string jsr $aefd
  219. jsr $ad9e
  220. jsr $b6a3
  221.  
  222. ldx $22
  223. ldy $23
  224. rts
  225.  
  226. ;**** get number from BASIC ****
  227.  
  228. get'number jsr $aefd
  229. jsr $ad8a
  230. jsr $b7f7
  231. lda $14  ; got low byte
  232. rts
  233.  
  234. instructions ldy #0
  235. - lda text,y
  236. beq +
  237. jsr chrout
  238. iny
  239. bne -
  240. + rts
  241.  
  242.  
  243. starting'line .word 0
  244. increment .word 0
  245. location .word 0
  246. line .buf 254
  247. count .byt 1
  248. temp .byt 0
  249. endflag .byt 0
  250. text .asc "sys addr,source drive,destination drive,sourcefile$,destfile$,starting line,increment":.byt 0
  251. source .byt 0
  252. destination .byt 0